From: Alistair Francis Date: Fri, 1 Dec 2017 00:21:21 +0000 (-0800) Subject: plat: zynqmp: Don't panic() if we can't find the FSBL struct X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=756e7f282510d7111c67d2f793b09fadf33e7d80;p=project%2Fbcm63xx%2Fatf.git plat: zynqmp: Don't panic() if we can't find the FSBL struct If we can't find the FSBL handoff struct don't panic and just use the defaults instead. We still print a warning to the user to let them know what we couldn't find it. Signed-off-by: Alistair Francis Acked-by: Michal Simek Reviewed-by: Siva Durga Prasad Paladugu --- diff --git a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c index 6dc1c2d2..471b1cc6 100644 --- a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c +++ b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c @@ -35,6 +35,19 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type) return &bl32_image_ep_info; } +/* + * Set the build time defaults. We want to do this when doing a JTAG boot + * or if we can't find any other config data. + */ +static inline void bl31_set_default_config(void) +{ + bl32_image_ep_info.pc = BL32_BASE; + bl32_image_ep_info.spsr = arm_get_spsr_for_bl32_entry(); + bl33_image_ep_info.pc = plat_get_ns_image_entrypoint(); + bl33_image_ep_info.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX, + DISABLE_ALL_EXCEPTIONS); +} + /* * Perform any BL31 specific platform actions. Here is an opportunity to copy * parameters passed by the calling EL (S-EL1 in BL2 & S-EL3 in BL1) before they @@ -69,17 +82,14 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2, SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE); if (zynqmp_get_bootmode() == ZYNQMP_BOOTMODE_JTAG) { - /* use build time defaults in JTAG boot mode */ - bl32_image_ep_info.pc = BL32_BASE; - bl32_image_ep_info.spsr = arm_get_spsr_for_bl32_entry(); - bl33_image_ep_info.pc = plat_get_ns_image_entrypoint(); - bl33_image_ep_info.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX, - DISABLE_ALL_EXCEPTIONS); + bl31_set_default_config(); } else { /* use parameters from FSBL */ enum fsbl_handoff ret = fsbl_atf_handover(&bl32_image_ep_info, &bl33_image_ep_info); - if (ret != FSBL_HANDOFF_SUCCESS) + if (ret == FSBL_HANDOFF_NO_STRUCT) + bl31_set_default_config(); + else if (ret != FSBL_HANDOFF_SUCCESS) panic(); } diff --git a/plat/xilinx/zynqmp/plat_startup.c b/plat/xilinx/zynqmp/plat_startup.c index 32c2db72..d3e182ca 100644 --- a/plat/xilinx/zynqmp/plat_startup.c +++ b/plat/xilinx/zynqmp/plat_startup.c @@ -161,7 +161,7 @@ enum fsbl_handoff fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t assert((atf_handoff_addr < BL31_BASE) || (atf_handoff_addr > (uint64_t)&__BL31_END__)); if (!atf_handoff_addr) { - ERROR("BL31: No ATF handoff structure passed\n"); + WARN("BL31: No ATF handoff structure passed\n"); return FSBL_HANDOFF_NO_STRUCT; }